//Auto Resize TextArea
var screenw = window.screen.width;
var screenh = window.screen.height;
if(screenw>1024){
	$(document).ready(function(){
		$(".textarea_aw").each(function(i){
			this.cols = 88;
		});
	});
}else{
	$(document).ready(function(){
		$(".textarea_aw").each(function(i){
			this.cols = 65;
		});
	});
}

//Auto Resize Word Size
if(screenh==768){
	$(document).ready(function(){
		$("#userfilepage").each(function(i){
			this.height = 395;
		});
	});
}else if(screenh==800){
	$(document).ready(function(){
		$("#userfilepage").each(function(i){
			this.height = 425;
		});
	});
}else if(screenh==1024){
	$(document).ready(function(){
		$("#userfilepage").each(function(i){
			this.height = 625;
		});
	});
}

//Flow History Show
var ishistoryhidden = 1;
var firstrow = 0;
function ShowHistory(){
	
	if(ishistoryhidden=='1'){
		$("#historylist:hidden").removeAttr('style').hide().fadeIn();
		ishistoryhidden=0;
	}else{
		var selectedEffect = 'blind';
		var options = {};
		//run the effect
		$("#historylist").effect(selectedEffect);
		ishistoryhidden=1;		
	}
	
	$(".historylist tr[id!=0]||tr[id!=1]").hide();
}
function ShowHistoryAllRow(){
	if(firstrow == 0){
		$(".historylist tr").show();
		$("#oclist").html("收起");
		firstrow = 1;
	}else{
		$(".historylist tr[id!=0]||tr[id!=1]").hide();
		$("#oclist").html("展开");
		firstrow = 0;
	}
}

//Flow UserFileList Show
var isfilehidden = 1;
function ShowUserFile(){
	if(isfilehidden=='0'){
		$("#userfilelist:hidden").removeAttr('style').hide().fadeIn();
		isfilehidden=1;
	}else{
		var selectedEffect = 'blind';
		var options = {};
		//run the effect
		$("#userfilelist").effect(selectedEffect);
		isfilehidden=0;		
	}
}

//Onchange Pop Input Title 
function InputTitle(inputt){
	inputt.title = inputt.value;
}

//tr odd/even color
$(document).ready(function(){
	$("#listtab tr:not([th]):even").addClass('listtab_tr');
	$("#listtab1 tr:not([th]):even").addClass('listtab_tr');
	$("#listtab2 tr:not([th]):even").addClass('listtab_tr');
//	$("#listtab tr:not([th]):odd").addClass('listtab_tr1');
});

//mouse cross table change color
$(document).ready(function(){  
	$("#listtab tr").mouseover(function(){  
		$(this).addClass("listtab_over");  
	}).mouseout(function(){  
		$(this).removeClass("listtab_over");  
	});  
	$("#listtab1 tr").mouseover(function(){  
		$(this).addClass("listtab_over");  
	}).mouseout(function(){  
		$(this).removeClass("listtab_over");  
	}); 
	$("#listtab2 tr").mouseover(function(){  
		$(this).addClass("listtab_over");  
	}).mouseout(function(){  
		$(this).removeClass("listtab_over");  
	}); 
});  

//page turn code
function pageturn(type){
   	var nowpage = $('#nowpage').val();
   	var allpages = $('#allpages').val();
   	if(type=='down'){
   		if(nowpage!=allpages&&allpages!='0'&&allpages!='1'){
   			$('#nowpage').val(parseInt(nowpage) +1);
   			document.forms[0].submit();
   		}
   	}else if(type=='up'){
   		if(nowpage!='1'&&allpages!='0'&&allpages!='1'){
   			$('#nowpage').val(parseInt(nowpage)-1);
   			document.forms[0].submit();
   		}
   	}else if(type=='turnto'){
   		var turnto = parseInt($('#turntopage').val());
   		var total = parseInt($('#total').val());
   		if(turnto>0&&turnto<total){
   			$('#nowpage').val(turnto);
   			document.forms[0].submit();
   		}
   	}
}

